!multitaper MUSIC

program main

  use problem_class
  use mtIO
  use cmtm
  use doa
  type(problem_type) :: ret
  double precision :: t1
  double precision :: W(2),d(8)
  complex(8)  :: ee(5)
  complex(8), dimension(2,2) :: b,c
  complex(8), dimension(100) :: WORK
  double precision, dimension(1) :: RWORK
 
  integer :: INFO
    double precision, dimension(100,3) :: v
  double precision, dimension(3) :: lambda
  double precision :: theta

  call read_main(ret)
  ret%nf=ret%npts/2+1
  b(1,1)=(1.0,0.0)
  b(1,2)=(1.0,1.0)
  b(2,1)=(1.0,-1.0)
  b(2,2)=(3.0,0.0)
 ! c=conjg(transpose(b))
   write(6,*)'original'
   write(6,*)b  
  call zheev('V','U',2,b,2,W,WORK,100,RWORK,INFO)
  write(6,*)'eigenvector'
  write(6,*)b  
  write(6,*)'eigenvalue'
!  write(6,*)c
  write(6,*)W
  write(6,*)'info'
  write(6,*)INFO
  !call dpss(100,0.01,3,v,lambda,theta)
  !write(6,*),'dpss',v(1:100,3)
  !write(45,*),v(1:100,3)
  do i=1,8
  d(i)=dble(i)
  enddo
    write(6,*)'data',d
allocate(ret%sxy(ret%nf,ret%n,ret%n))
allocate(ret%alib(ret%n,ret%ps,ret%qs))
  write(6,*)'n',ret%n
!do t1=ret%begin+ret%ori,ret%over+ret%ori,ret%step
  ret%t1=ret%begin+ret%ori
  call cmtmall(ret)
  write(6,*)'sxy',ret%sxy(1:10,1,1)
  call doaMUSIC(ret)
!write(6,*)'ok before exit'   
!  write(6,*)ret%sxy(1,1,1);
!end do
write(6,*)'ok before exit'
deallocate(ret%sxy)
deallocate(ret%alib)
end program main 
